Repository navigation
feat(python-client): retry a GET on 429 and 502-504 with exponential backoff - #12513
Merged
rubenfiszel merged 6 commits intoNov 19, 2026
Merged
Conversation
…backoff A script that reads many variables or resources at once can get a 429 or a 502/503/504 back from a busy server, and the call failed at once. Windmill.get now retries up to 3 times, 1s, 2s and 4s apart, or after the Retry-After seconds the server sends (capped at 60). Other statuses, and POSTs, are not retried.
burrows99
requested review from
alpetric,
hugocasa and
rubenfiszel
as code owners
November 17, 2026 21:54
Contributor
There was a problem hiding this comment.
All reported issues were addressed across 2 files
Reply with feedback, questions, or to request a fix.
View guided diff | Re-trigger cubic
…504 and 60s cap paths
… retries to 15s Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
All reported issues were addressed across 2 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
View guided diff | Re-trigger cubic
…igit float() rejects
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
A script that reads many variables or resources at once can get a 429 or a 502/503/504 back from a busy server. The Python client raised on the first one, so the script failed even though the same read would have worked a second later.
Windmill.getnow retries a GET that comes back 429, 502, 503 or 504, up to 3 times, 1s, 2s and 4s apart. When the response carriesRetry-After(delay-seconds or an HTTP-date), it waits that long instead; an unparseable value falls back to the backoff delay. One GET spends at most 15s sleeping in total: a wait that would exceed what is left of that budget ends the retries. After the last attempt it returns the last response, so the caller sees the same error as before. Every GET the client sends goes throughWindmill.get(get_variable,get_resource, job status and results, ...), so they all get it. POSTs and every other status are not retried: a POST may not be safe to send twice, and a 4xx won't change on a retry.Two new keyword arguments on
Windmill.get:retry_transient=Falseopts a GET out of retries. The Slack approval request uses it, since repeating a 502/504 there could post a second approval message.retry_budgetlowers the 15s budget.wait_jobpasses the time left before its owntimeout, so retries cannot push it past that timeout.The change is in
python-client/wmill/wmill/client.py(+58/-3), plus a test filetests/test_get_retry.py. No new dependency. The TypeScript client is not touched.Reproduced on
mainat a2c04c2.flowchart TD A[Script calls wmill.get_variable] --> B[Server answers 429 or 503] B -->|Before| C[The call raises at once] B -->|After| D[Wait 1s, 2s, 4s or Retry-After, then try again] D -->|Server recovers| E[The call returns the value] D -->|Still failing after 3 retries| F[The call raises the same error as before]Narrated recording, before then after (sound on):
evidence.mp4
The recording is a terminal running a small script that calls
wmill.get_variableagainst a local stub of the variables endpoint. The stub logs each request it gets and the status it sends back. The first part imports the client frommain, the rest from this branch. Nothing is edited.Edge cases and unchanged behaviour checked
All checked in the recording, on this branch:
Retry-After: 3, then a 200: the client waits 3s and succeeds.Checks run
pytest tests/inpython-client/wmill(Python 3.14, assdk-tests.ymlruns it): 141 passed.tests/test_get_retry.pyfails onmainand passes on this branch. It also covers the 15s budget, an HTTP-date and an unparseableRetry-After, andretry_transient=False.Related issue
Part of #2332. This covers the Python client's reads. The TypeScript client has no retry yet.
AI tools (Claude Code) assisted with this change; the behaviour was verified as shown.
Summary by cubic
Windmill.getnow retries GETs answered with 429, 502, 503, or 504 so scripts reading many variables or resources no longer fail on the first transient server error.Up to 3 retries run 1s, 2s, and 4s apart, or wait the
Retry-Afterthe response carries in seconds or HTTP-date form — falling back to the backoff delay when unparseable — with the total sleep bounded to 15s per GET. Callers whose GET has a side effect can opt out viaretry_transient=False; the slack approval request does, since repeating its 502/504 would post a second approval. The job-result polling loop now passes aretry_budgetmatching its remaining timeout. After the last attempt the last response is returned, so callers get the same error as before. POSTs and other statuses are never retried.Part of #2332.
Written for commit 4a7ffd1. Summary will update on new commits.